package com.gmj.controller;


import com.gmj.entity.Laboratory;
import com.gmj.service.ILaboratoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author gmj
 * @since 2022-01-29
 */
@RestController
@RequestMapping("/laboratory")
public class LaboratoryController {
    @Autowired
    private ILaboratoryService ls;
    @GetMapping("/selectAll")
    public List<Laboratory> selectAll(){
        return ls.list();
    }
    @PostMapping("/add")
    public void add(@RequestBody Laboratory laboratory){
        ls.save(laboratory);
    }
    @DeleteMapping("/delete/{id}")
    public void delete(@PathVariable("id") int id){
        ls.removeById(id);
    }
}

